package demo1;

import javax.swing.*;
import java.awt.*;

public class ComponentInWindows extends JFrame {
    JCheckBox checkBox1 , checkBox2 ;
    JRadioButton jRadioButton1 , jRadioButton2 ;
    JComboBox<String> comboBox ;
    ButtonGroup group ;
    public ComponentInWindows(){
        init();
        setVisible(true);
        setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

    }
    void init(){
        setLayout(new FlowLayout());
        this.comboBox = new JComboBox<String>();
        this.checkBox1 = new JCheckBox("喜欢音乐");
        this.checkBox2 = new JCheckBox("喜欢旅游");
        this.group = new ButtonGroup();
        this.jRadioButton1 = new JRadioButton("男");
        this.jRadioButton2 = new JRadioButton("女");
        this.group.add(this.jRadioButton1);
        this.group.add(this.jRadioButton2);
        this.add(checkBox1);
        this.add(checkBox2);
        this.add(jRadioButton1);
        this.add(jRadioButton2);
        comboBox.addItem("音乐天堂");
        comboBox.addItem("武术天地");
         add(comboBox);
    }

}